<?php

namespace Xrfg\Core\Trading\Spot\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * Xrfg\Core\Trading\Spot\Models\Kline.
 *
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Spot\Models\Kline newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Spot\Models\Kline newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Spot\Models\Kline query()
 * @mixin \Eloquent
 */
class Kline extends Model
{
    public $timestamps = false;

    public static $types = [1, 5, 15, 30, 60, 240, 1440, 10080];

    public $symbol;

    public $type;

    public $incrementing = false;

    protected $primaryKey = 'time_open';

    protected $connection = 'mysql_kline';

    public function __construct($symbol = null, $type = null)
    {
        if ($symbol) {
            $this->symbol = $symbol;
            $this->type = $type;
            $this->table = "kline_{$symbol}_{$type}";
        }
        parent::__construct();
    }
}
